package com.viu.technology.listener;

import com.viu.technology.po.User;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 使用Spring自带的监听功能
 */
@Component
public class RegisterListener implements ApplicationListener<UserRegisterEvent> {


    @Override
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
        User user = userRegisterEvent.getUser();
        System.out.println("applicationListener注册信息-用户名：" + user.getName());
    }
}
